﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonClasses;

namespace TEST
{
    public partial class numberTiString : Form
    {
        public numberTiString()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            CommonClasses.class_NumberToString nm = new class_NumberToString();

            string strNumber = TextBox1.Text.Trim().Replace(".", ",").Replace("-", ",");
            string strCurrency = cmbCurrency.SelectedItem.ToString();
            
            //MessageBox.Show(cmbCurrency.SelectedText+"\n"+cmbCurrency.SelectedItem+"\n"+cmbCurrency.SelectedValue);

            if(TextBox1.Text.Trim() != "")
            {

            class_NumberToString cl = new class_NumberToString();

            switch (strCurrency)
            {
                case "сомони":
                    txtAnswer.Text = cl.NumbToStr(decimal.Parse(strNumber), 1, "сомони", "сомони", "сомони", "дирам");
                    break;
                case "доллар":
                    txtAnswer.Text = cl.NumbToStr(decimal.Parse(strNumber), 1, "доллар", "доллара", "долларов", "цент");
                    break;
                case "евро":
                    txtAnswer.Text = cl.NumbToStr(decimal.Parse(strNumber), 1, "евро", "евро", "евро", "цент");
                    break;
                case "рубль":
                    txtAnswer.Text = cl.NumbToStr(decimal.Parse(strNumber), 1, "рубль", "рубля", "рублей", "копеек");
                    break;
                default:
                    txtAnswer.Text = cl.NumbToStr(decimal.Parse(strNumber), 1, "сомони", "сомони", "сомони", "дирам");
                    break;
            }

            // NunberToSting(45836,USD) 
            // USD
            // RUR
            // EUR
            // SOM

            }else
            {
                MessageBox.Show("Money Field Empty  !!!");
            }

        }

        private void numberTiString_Load(object sender, EventArgs e)
        {
            this.Text = "Максимальное число: " + Convert.ToString(Int64.MaxValue);
            cmbCurrency.SelectedIndex = 0;
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
